package org.taobao.ibatiside.ui.binding;

import org.eclipse.core.databinding.conversion.IConverter;

public class StringToIntegerConverter implements IConverter {

	@Override
	public Object getFromType() {
		return String.class;
	}

	@Override
	public Object getToType() {
		return Integer.class;
	}

	@Override
	public Object convert(Object fromObject) {
		String string = (String)fromObject;
		if (fromObject == null || string.length() < 1) return null;
		return new Integer(string);
	}

}
